
import 'package:easydouban/bean/i_share_image_entity.dart';
import 'package:easydouban/generated/json/base/json_convert_content.dart';
import 'package:easydouban/http/httpUtil.dart';
import 'package:easydouban/http/apiPath.dart';
import '../bean/i_movie_detail_entity.dart';
import '../bean/i_top_entity.dart';


///电影榜单前250名接口数据解析
Future<List<ITopEntity>?> getTopList(int skip,int limit) async {
    var url = HttpPath.getTop250(skip, limit);
    final result = await HttpUtil.getInstance().get(url, null);
    return jsonConvert.convertListNotNull<ITopEntity>(result);
}

///电影详情数据解析
Future<IMovieDetailEntity> getMovieDetail(String doubanid) async{
  var url = HttpPath.getMovieDetail(doubanid);
  final result = await HttpUtil.getInstance().get(url, null);
  return IMovieDetailEntity.fromJson(result);
}

///电影搜索列表解析
Future<List<ITopEntity>?> getSearchList(String key) async {
  var url = HttpPath.getSearchContent(key);
  final result = await HttpUtil.getInstance().get(url, null);
  return jsonConvert.convertListNotNull<ITopEntity>(result);
}

///分享图片解析
Future<IShareImageEntity?> getShareImage(String doubanId) async {
  var url = HttpPath.getShareImage(doubanId);
  final result = await HttpUtil.getInstance().get(url, null);
  return IShareImageEntity.fromJson(result);
}

